home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
choices
/
chcssml1.lha
/
Process.h
< prev
next >
Wrap
C/C++ Source or Header
|
1989-02-06
|
3KB
|
107 lines
/*
* This file is part of the Choices Operating System Simulator
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989 The University of Illinois Board of Trustees.
* All Rights Reserved.
* CONFIDENTIAL INFORMATION. Distribution restricted under license agreement.
*
* Author: Gary M. Johnston (johnston@cs.uiuc.edu)
* Project Manager and Principal Investigator: Roy Campbell (roy@cs.uiuc.edu)
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*/
/*
* Process.h - Declarations of classes ProcessTask, ProcessStatistics,
* Process, and IdleProcess.
*
* $Header: Process.h,v 1.4 88/02/18 16:09:40 johnston Exp $
* $Locker: johnston $
*/
#ifndef PROCESS_H
#define PROCESS_H
#include <task.h>
#include "Object.h"
const int RunToCompletion = -1;
class CPUManager;
class CPU;
class Process;
typedef int (* ProcessEntry)(void *);
class ProcessTask : public task {
Process * process;
int preemptable;
public:
ProcessTask( Process * process, ProcessEntry entry, void * argp,
int preemptable, char * procName );
char * getName();
Process * getProcess()
{ return (process); }
int isPreemptable();
int setPreemptable( int flag );
};
class ProcessStatistics {
friend class Process;
Process * process; // Associated Process.
int runCount; // Number of times we've been dispatched.
int runTime; // Total run time.
int lastRun; // Last time we were dispatched.
public:
ProcessStatistics( Process * p );
void print();
};
class Process : public Object {
friend class ProcessTask;
protected:
ProcessTask * processTask; // Task actually running.
ProcessStatistics * statistics; // Statistics for this Process.
CPU * cpu; // Running on this CPU.
void * schedulerInfo; // Maintained by scheduler.
int quantum; // Time-slice quantum.
int residual; // Time left if interrupted.
public:
Process( ProcessEntry entry, void * argp,
int preemptable = 1, char * name = 0 );
~Process();
/*
* These should be used only by the CPU manager or a scheduler.
*/
CPU * getCPU()
{ return (cpu); }
void setQuantum( int quantum );
int getQuantum(); // RunToCompletion, 0, 1,...
void setResidual( int residual );
int getResidual();
/*
* These should be used externally only by the CPU manager.
*/
void stop(); // Stop a Process task.
void start(CPU * cpu); // Start a Process task.
int getState(); // IDLE, RUNNING, or TERMINATED.
};
class IdleProcess : public Process {
public:
IdleProcess(CPU * cpu, char * name = 0 );
~IdleProcess();
};
#endif /* PROCESS_H */